<?php

namespace App\Listeners;

use App\Biz\ConfigBiz;
use App\Biz\VisitorReservesLogBiz;
use App\Events\VisitorReservesEvent;

class VisitorReservesListener
{
    protected VisitorReservesLogBiz $visitorReservesLogBiz;

    /**
     * @param VisitorReservesLogBiz $visitorReservesLogBiz
     */
    public function __construct(VisitorReservesLogBiz $visitorReservesLogBiz)
    {
        $this->visitorReservesLogBiz = $visitorReservesLogBiz;
    }


    /**
     * Handle the event.
     *
     * @param VisitorReservesEvent $event
     * @return void
     */
    public function handle(VisitorReservesEvent $event): void
    {
        $this->visitorReservesLogBiz->create($event->config,$event->reserves,$event->visitor);
    }
}
